package com.cjw.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.util.Assert;

/**
 * 增强的 DateFormatUtils
 *
 */
public abstract class DateFormatUtils extends org.apache.commons.lang3.time.DateFormatUtils {
	/**
	 * 解析日期
	 * @param dateString
	 * @param pattern
	 * @return
	 * @throws ParseException
	 */
	public static Date parse(String dateString, String pattern) throws ParseException {
		Assert.hasText(dateString);
		Assert.hasText(pattern);

		DateFormat format = new SimpleDateFormat(pattern);
		return format.parse(dateString);
	}
}
